// 实装信息id
var equipId;

$(function(){
    // 下拉框查询所有装备名称/仿真模型
    $.ajax({
        url:"/rm/physical/getAllEquipment",
        type:'post',
        success:function(result){
            $.each(result.data,function(index,item){
                
                $("#equipType").append("<option id="+item.id+">"+item.equipmentName+"</option>");
            })
        },
        error:function(){
            layer.msg("系统错误");
        }
    })

    // 通过装备名称/仿真模型id(--equipId)查询主要性能
    $("#equipType").change(function() {
        
        equipId = $("#equipType").find("option:checked").attr("id");
        $.ajax({
            url:"/rm/physical/getTypesByEquipment",
            data:{equipmentId:equipId},
            type:"post",
            success:function(result){

                $("#mainPerformance").empty();
                var str ="";
                $.each(result.data,function(index,item){
                    console.log(item.id,item.typeName);
                    str+="<div class='col-xs-4'>"+
                            "<div class='form-group'>"+
                                "<label for='range' style='margin-left: 20px;'>"+item.typeName+"</label>"+
                                "<input type='text' name='range' placeholder="+'请输入'+item.typeName+" class='form-control' >"+
                            "</div>"+ 
                        "</div>"
                })
                
                
                $("#mainPerformance").append(str);
            },
            error:function(){

            }
        })
    });

})
